package com.bcxj.servicedriveruser.servcie;

import com.bcxj.internalcommon.dto.ResponseResult;
import com.bcxj.servicedriveruser.mapper.DriverUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * ClassName: CityDriverService
 * Package: com.bcxj.servicedriveruser.servcie
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/11/13 11:04
 * @Version 1.0
 * @Since 1.0
 */
@Service
public class CityDriverService {

    @Autowired
    private DriverUserMapper driverUserMapper;

    /**
     * 查询城市是否提供服务
     * @param cityCode
     * @return
     */
    public ResponseResult<Boolean> isAlailableDriver(String cityCode) {
        // 1 查询可用的司机
        Integer num = driverUserMapper.selectDriverUserCountByCityCode(cityCode);
        // 2 解析结果并返回
        return num > 0 ? ResponseResult.success(true) : ResponseResult.success(false);
    }
}
